package huaweiod.third;

import java.util.Arrays;
import java.util.Scanner;

/**
 * 阿里巴巴找黄金宝箱(I)
 * https://fcqian.blog.csdn.net/article/details/130764272
 */
public class B_GoldChest1 {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int[] arr = Arrays.stream(in.nextLine().split(",")).mapToInt(Integer::parseInt).toArray();
        int[] sum = new int[arr.length];
        sum[0] = arr[0];
        for (int i = 1; i < arr.length; i++) {
            sum[i] = arr[i] + sum[i - 1];
        }
        int ans = -1;
        for (int i = 0; i < arr.length; i++) {
            int left = sum[i] - arr[i];
            int right = sum[arr.length - 1] - sum[i];
            if (left == right) {
                ans = i;
                break;
            }
        }
        System.out.println(ans);
    }
}
